Optimal. Leaf size=148 \[ \frac {8 i a^3 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n \left (n^2+3 n+2\right )}+\frac {4 i a^2 (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f \left (n^2+3 n+2\right )}+\frac {i a (a+i a \tan (e+f x))^{2-n} (d \sec (e+f x))^{2 n}}{f (n+2)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.21, antiderivative size = 148, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.062, Rules used = {3494, 3493} \[ \frac {4 i a^2 (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f \left (n^2+3 n+2\right )}+\frac {8 i a^3 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n \left (n^2+3 n+2\right )}+\frac {i a (a+i a \tan (e+f x))^{2-n} (d \sec (e+f x))^{2 n}}{f (n+2)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3493
Rule 3494
Rubi steps
\begin {align*} \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{3-n} \, dx &=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n}}{f (2+n)}+\frac {(4 a) \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx}{2+n}\\ &=\frac {4 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f \left (2+3 n+n^2\right )}+\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n}}{f (2+n)}+\frac {\left (8 a^2\right ) \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n} \, dx}{2+3 n+n^2}\\ &=\frac {4 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f \left (2+3 n+n^2\right )}+\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n}}{f (2+n)}+\frac {8 i a^3 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{f n \left (2+3 n+n^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.96, size = 129, normalized size = 0.87 \[ \frac {i a^3 \sec ^2(e+f x) (\cos (3 f x)+i \sin (3 f x)) (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n} \left (\left (n^2+3 n+4\right ) \cos (2 (e+f x))+i n (n+3) \sin (2 (e+f x))+2 (n+2)\right )}{f n (n+1) (n+2) (\cos (f x)+i \sin (f x))^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.61, size = 171, normalized size = 1.16 \[ \frac {{\left ({\left (i \, n^{2} + 3 i \, n + 2 i\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + {\left (i \, n^{2} + 5 i \, n + 6 i\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (2 i \, n + 6 i\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 2 i\right )} \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{2 \, n} e^{\left (-i \, e n + {\left (-i \, f n + 3 i \, f\right )} x - 6 i \, f x - {\left (n - 3\right )} \log \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right ) - {\left (n - 3\right )} \log \left (\frac {a}{d}\right ) - 3 i \, e\right )}}{2 \, {\left (f n^{3} + 3 \, f n^{2} + 2 \, f n\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \sec \left (f x + e\right )\right )^{2 \, n} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{-n + 3}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 3.78, size = 0, normalized size = 0.00 \[ \int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{3-n}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 1.59, size = 617, normalized size = 4.17 \[ \frac {2^{n + 3} a^{3} d^{2 \, n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - i \cdot 2^{n + 3} a^{3} d^{2 \, n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 8 \, {\left (a^{3} d^{2 \, n} n + 2 \, a^{3} d^{2 \, n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + 4 \, {\left (a^{3} d^{2 \, n} n^{2} + 3 \, a^{3} d^{2 \, n} n + 2 \, a^{3} d^{2 \, n}\right )} 2^{n} \cos \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right ) - {\left (8 i \, a^{3} d^{2 \, n} n + 16 i \, a^{3} d^{2 \, n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) - {\left (4 i \, a^{3} d^{2 \, n} n^{2} + 12 i \, a^{3} d^{2 \, n} n + 8 i \, a^{3} d^{2 \, n}\right )} 2^{n} \sin \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right )}{{\left ({\left (-i \, a^{n} n^{3} - 3 i \, a^{n} n^{2} - 2 i \, a^{n} n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (4 \, f x + 4 \, e\right ) + {\left (a^{n} n^{3} + 3 \, a^{n} n^{2} + 2 \, a^{n} n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (4 \, f x + 4 \, e\right ) + {\left (-i \, a^{n} n^{3} - 3 i \, a^{n} n^{2} - 2 i \, a^{n} n + {\left (-2 i \, a^{n} n^{3} - 6 i \, a^{n} n^{2} - 4 i \, a^{n} n\right )} \cos \left (2 \, f x + 2 \, e\right ) + 2 \, {\left (a^{n} n^{3} + 3 \, a^{n} n^{2} + 2 \, a^{n} n\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n}\right )} f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 12.47, size = 321, normalized size = 2.17 \[ -\left (\cos \left (6\,e+6\,f\,x\right )-\sin \left (6\,e+6\,f\,x\right )\,1{}\mathrm {i}\right )\,{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^{2\,n}\,\left (\frac {{\left (a+\frac {a\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^{3-n}}{f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}+\frac {\left (\cos \left (4\,e+4\,f\,x\right )+\sin \left (4\,e+4\,f\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^{3-n}\,\left (n^2+5\,n+6\right )}{2\,f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}+\frac {\left (\cos \left (6\,e+6\,f\,x\right )+\sin \left (6\,e+6\,f\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^{3-n}\,\left (n^2+3\,n+2\right )}{2\,f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}+\frac {\left (2\,n+6\right )\,\left (\cos \left (2\,e+2\,f\,x\right )+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^{3-n}}{2\,f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \sec {\left (e + f x \right )}\right )^{2 n} \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{3 - n}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________